' Clay Pigeon !
' 
' Based on A retro game by electricwalrus, found at https://retrocoders.phatcode.net/index.php?topic=627.0;topicseen
' This BASIC Anywhere Machine port and mods by Charlie Veniot

' Changed instances of INKEY, CHR() and STR() to INKEY$, CHR$() and STR$()
' SLEEP:  FB uses milliseconds; BAM uses seconds
' And other changes/additions noted below with a ✏

'✏ #lang "fblite"
'✏ Option Gosub
'✏ Option Explicit

_initaudio '✏ added

Dim i as byte
Dim ii as byte
Dim score as integer
Dim lives as byte

play_new_round: '✏ added

Screen 0 '✏ Changed from 17
Color 14
Print "Shoot the clay pigeon!"
Print "Press the space bar to fire gun and shoot the object"
Print "Press a key to start playing." : temp$ = input$(1) '✏ replace Sleep

score = 0
lives = 5

start:
Cls
Gosub UpdateScore
Locate 1,1
COlor 9
Print "Shoot the clay pigeon!";
color 14
Locate 25,65
Print "^";
color 10
Beep
for i = 2 to 79   
    locate 2,i-1
    Print " " + chr$(4);
    sleep 0.04
    '✏ If MultiKey(1) then end
    if inkey$ <> "" AND i > 5 then Goto Shoot
next
Locate 25,1
Color 15
Print "The Clay Pigeon Got Away!";
sleep 3
goto start


shoot:
for ii = 24 to 1 Step -1
    Locate ii+1,64 '✏ changed from 65 to 64
    Print "   ";  '✏ changed from " " to "   "
    Locate ii,64 '✏ changed from 65 to 64
    color 10
    Print ".^."; '✏ changed from "^" to ".^."
    Sleep 0.04
next
Locate 25,1
Color 15
if i = 65 then 
    Print "You got it! Great work!";
    Score = Score + 100
    Gosub updatescore
    Beep
Else
    if i > 63 and i < 67 then '✏ added
        print "You grazed it!";
        Score = Score + 20
    else        
        Print "Your Missed!";
    end if
    lives = lives - 1
    Gosub updatescore
    If lives = 0 then
        Cls
        Color 15
        Print "Game Over - Final Score: " + str$(score)
        Sleep 3
        goto play_new_round '✏ replaces End
    end if
end if
Sleep 3
Goto start

updatescore:
Color 11
locate 24,1
Print "Score: " + str$(score) + " - Lives: " + str$(lives)
return